﻿@model MvcApplication2.Models.Recipe

@{
    ViewBag.Title = "Przepis";
}

<h2>Przepis</h2>

@if(Session["LoggedLogin"]!=null){
    @Html.ActionLink("Lubię to! :)", "Like/" + Model.RecipeID, "Votes")
    @Html.Raw(" | ");
    @Html.ActionLink("Nie lubię tego! :(", "DontLike/" + Model.RecipeID, "Votes")
    @Html.Raw(" ");
}
else
{
    @Html.Raw("Zaloguj się, aby móc głosować ");
}
| Ocena: @Html.Display("likes")/@Html.Display("all") (@Html.Display("percent")%)
<br /><br />

<fieldset>
    <legend>
        @Html.DisplayFor(model => model.Title)
    </legend>

    @if (Model.ImagePath != null)
    {
        <br />
        <img src="../../uploads/@Html.DisplayFor(model => model.ImagePath)" alt="Obrazek"/>
    }
        
    <div class="display-label">Kategoria: @Html.DisplayFor(model => model.Category.Name)</div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Category.Description)
    </div>

    <div class="display-label">Dodał:
        @Html.DisplayFor(model => model.User.Login)
        @if (Model.User.FirstName != null || Model.User.LastName != null)
        {
            @Html.Raw("(");
            @Html.DisplayFor(model => model.User.FirstName)
       if (Model.User.FirstName != null && Model.User.LastName != null)
       {
                @Html.Raw(" ");
       }
            @Html.DisplayFor(model => model.User.LastName)
            @Html.Raw(")");
        }
    </div>

    <div class="display-label">Opis:</div>
    <div class="display-field">
        <br />
        @Html.DisplayFor(model => model.Description)
    </div>


</fieldset>
<p>
    @Html.ActionLink("Wróć", "Index")
    @if (Model.User.Login.Equals(Session["LoggedLogin"]) || true.Equals(Session["LoggedAdmin"]))
    {
        @Html.Raw(" | ")
        @Html.ActionLink("Edytuj", "Edit", new { id = Model.RecipeID })
    }
</p>
